from BeautifulSoup import BeautifulSoup

def parseOnePageMain(html):
    soup = BeautifulSoup(html)
    for p in soup.findAll('p','name mbspace'):
        print p

def getPageCnt(html):
    soup = BeautifulSoup(html)
    max_num = 0
    for i in soup.find('div', 'W_pages W_pages_comment').findAll('a')
        if len(i.contents) > 1:
            continue;
        try:
            page_num = int(i.contents[0])
        except:
            continue
        if int(i.contents) > max_num:
            max_num = int(i.contents[0])
                
    return max_num
